home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
CMOS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-11-12
|
1KB
|
58 lines
procedure write_cmos(regno:byte;newval:byte);
begin
asm
pushf
cli
mov al,regno
out 70h,al
mov al,newval
out 71h,al
popf
end;
end;
function read_cmos(regno:byte):byte;
var
regval : byte;
begin
asm
pushf
cli
mov al,regno
out 70h,al
in al,71h
mov regval,al
popf
end;
read_cmos:=regval;
end;
const
hexdigit : string[16] =('0123456789ABCDEF');
function b2h(b:integer):string;
begin
if (b<0) or (b>255)
then b2h:='__'
else b2h:=hexdigit[(b shr 4)+1]+hexdigit[(b and 15)+1];
end;
type
cmos_data = record
array [0..$3F] of byte;
chksum : word;
end;
var
cdat : cmos_data;
r : byte;
begin
for r:=$10 to $2d do
begin
t:=t+read_cmos(r);
writeln('@',b2h(r),':',b2h(read_cmos(r)));
end;
writeln('Total = ',b2h(hi(t)),b2h(lo(t)));
writeln('@2e:',b2h(read_cmos($2e)));
writeln('@2f:',b2h(read_cmos($2f)));
end.